FROM node:10.13-slim AS build

WORKDIR /src
COPY . .
#ENV HOME=/tmp
ARG BUILD_TYPE
RUN npm config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/ \
    && npm config set registry https://registry.npm.taobao.org \
    && npm run build-${BUILD_TYPE:-dev} \
    && npm install --skip-installed \
    && npm run build${BUILD_TYPE:-dev} \
    && npm prune --production \
    && npm cache clean --force
